package com.globallogic.javatrainings.sergiiivanov.tests;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import com.globallogic.javatrainings.sergiiivanov.model.MyArray;

@SuppressWarnings("serial")
public class MyArrayOverrideTest extends MyArray<String> {
    String a1 = "1",a2="2",a3="3",a4="4",a5="5";
    public MyArrayOverrideTest() {
        super(new String[0]);
    }
    @Before
    public void setupTest() {
        assertEquals(0, size());
        add(a1);
        assertEquals(1, size());
        add(a2);
        assertEquals(2, size());
        add(a3);
        assertEquals(3, size());
        add(a4);
        assertEquals(4, size());
    }
    
    @Test
    public void testIndexOf() {
        assertEquals(0, indexOf(a1));
        assertEquals(1, indexOf(a2));
        assertEquals(2, indexOf(a3));
        assertEquals(3, indexOf(a4));
        assertEquals(-1, indexOf(a5));
    }
    
    @Test
    public void removeObjectTest() {
        assertTrue(remove(a1));
        assertTrue(remove(a2));
        assertTrue(remove(a3));
        assertTrue(remove(a4));
        assertFalse(remove(a5));
    }
    
}
